<div class="headertitle">
	<span class="header"><?php echo $this->Html->link("Forums", array("controller" => "forums", "action" => "displayForums")); ?></span>
	<span class="header"><?php echo $subForum['SubForum']['name']; ?></span>
</div>
<?php
	if(AuthComponent::User('role') >= $subForum['SubForum']['role']){
		echo $this->Html->link(
			$this->Html->image("forum_newthread.png"), array(
				'controller' => 'threads',
				'action' => 'add',
				'id' => $this->request->params['id'],
				'slug' => $this->request->params['slug']
			),
			array('escape' => false)
		);
	}else{
		echo $this->Html->image("forum_locked.png");
	}
?>
<div style="float: right; margin-bottom: 10px">
<?php
	$this->Paginator->options(array(
		'url' => array(
			'controller' => 'subforums',
			'action' => 'displayTopics',
			'id' => $this->params['id'],
			'slug' => $this->params['slug']
		)
	));
	echo $this->Paginator->numbers();

?>
</div>
<?php echo $this->Form->Create("Thread", array("controller" => "thread", "action" => "delete")); ?>
<table cellspacing="0">
	<thead>
		<tr>
			<th style="width: 1px"></th>
			<th style="width: 1px"></th>
			<th style="width: 550px" colspan="2">Title</th>
			<th>Info</th>
			<th>Last Post</th>
		</tr>
	</thead>
	<tbody>
	<?php foreach($threads as $thread): ?>
		<tr>
			<td><?php echo $this->Form->checkbox("selectedThreads.", array("hiddenField" => false, "value" => $thread['Thread']['id'])); ?></td>
			<td><?php
					if($thread['Thread']['sticky'] == "1"){
						echo $this->Html->image('pinned.png');
					}elseif($thread['Thread']['locked'] == "1"){
						echo $this->Html->image('lock-icon.png');
					}else{
						echo $this->Html->image('forum_thread.png');
					}
				?>
			</td>
			<td valign="middle" style="width: 1px; border-right: 0px; padding-right: 0px">
				<div class="display_picturetopic">
					<?php echo $this->Html->image('/attachments/avatars/small/' . $thread['User']['user_file_path']); ?>
				</div>
			</td>
			<td valign="middle">
				<?php echo $this->Html->link($thread['Thread']['title'], array(
					"controller" => "thread",
					"action" => $thread['Thread']['id'] . "-" . Inflector::slug($thread['Thread']['title'], '-'))); ?><br />
				<div class="topics_date">
				<?php echo $thread['User']['username']; ?>
				&bull;
				<?php echo $thread['Thread']['created']; ?>
				</div>
			</td>
			<td>
				Viewed: <?php echo $thread['Thread']['views']; ?><br />
				Replies: <?php echo $thread['Thread']['reply_count']; ?>
			</td>
			<td valign="middle">
				<?php echo $thread['LatestUser']['username']; ?><br />
				<div class="topics_date">
					<?php echo $thread['Thread']['latest_reply_created']; ?>
				</div>
			</td>
		</tr>
	<?php endforeach; ?>
	</tbody>
</table>
<?php echo $this->Form->End("Delete Selected"); ?>
<div style="float: right; margin-top: 10px">
<?php
	$this->Paginator->options(array(
		'url' => array(
			'controller' => 'subforums',
			'action' => 'displayTopics',
			'id' => $this->params['id'],
			'slug' => $this->params['slug']
		)
	));
	echo $this->Paginator->numbers();

?>
</div>
<div style="margin-top: 10px">
	<?php
		if(AuthComponent::User('role') >= $subForum['SubForum']['role']){
			echo $this->Html->link(
				$this->Html->image("forum_newthread.png"), array(
					'controller' => 'threads',
					'action' => 'add',
					'id' => $this->request->params['id'],
					'slug' => $this->request->params['slug']
				),
				array('escape' => false)
			);
		}else{
			echo $this->Html->image("forum_locked.png");
		}
	?>
</div>